//
//  PIGraphic.m
//  iPaint
//
//  Created by Jedd Haberstro on 2/11/07.
//  Copyright 2007 __MyCompanyName__. All rights reserved.
//

#import "PIGraphic.h"


@implementation PIGraphic

- (id)init {
    self = [super init];
    if (self) {
		_path = [[NSBezierPath bezierPath] retain];
	}
	return self;
}

-(void)dealloc
{
	[_path release];
	[super dealloc];
}

//////////////////////////////////////
// Get Basic Setting and Primitives //
//////////////////////////////////////
/*-(void)setBounds:(NSRect)rect
{
	if( !NSEqualRects( rect, _bounds ) )
	{
		_bounds = rect;
	}
}

-(NSRect)bounds
{
	return _bounds;
}*/

-(NSBezierPath *)path
{
	return _path;
}

-(void)setStrokeWidth:(float)width
{
	if( width != _strokeWidth )
	{
		_strokeWidth = width;
		[_path setLineWidth:_strokeWidth];
	} 
}

-(float)strokeWidth
{
	return _strokeWidth;
}

-(void)setStrokeColor:(NSColor *)color
{
	if( _strokeColor != color )
	{
		_strokeColor = color;
	}
}

-(NSColor *)strokeColor;
{
	return _strokeColor;
}

-(void)setFillColor:(NSColor *)color
{
	if( _fillColor != color )
	{
		_fillColor = color;
	}
}

-(NSColor *)fillColor
{
	return _fillColor;
}

-(void)setCanGraphicFill:(BOOL)decision 
{
	if( decision == YES )
	{ 
		_canFill = YES;
	}
	else 
	{
		_canFill = NO;
	}
}

-(BOOL)canFill;
{
	return _canFill;
}

-(void)setCanGraphicStroke:(BOOL)decision
{
	if( decision == YES )
	{ 
		_canStroke = YES;
	}
	else 
	{
		_canStroke = NO;
	}	
}
-(BOOL)canStroke
{
	return _canStroke;
}


///////////////////////////////////
// Graphic Location Manipulation // 
// 		     **Todo**            //
//	    - Implement Knobs        //
///////////////////////////////////
/*-(void)translateByVector:(NSPoint)vector
{
	[self setBounds: NSOffsetRect( [self bounds], vector.x, vector.y )];
}
-(void)scaleBy:(float)amount
{
	[self bounds].size.width = [self bounds].size.width * amount;
	[self bounds].size.length = [self bounds].size.length * amount;
	return;
}

-(void)rotateByAngle:(float)angle
{
	// To be overrriden in subclasses
	return;
}

-(void)rotateByRadian:(float)radian
{
	// To be overrriden in subclasses
	return;
}

-(void)flipYAxis
{
	// To be overrriden in subclasses
	return;
}

-(void)flipXAxis
{
	// To be overrriden in subclasses
	return;
}*/

@end
